package com.krstin.designpattern.dependenceInversionPrinciple.implement1;

public class Example1 {

    public static void main(String[] args) {
        new GeneralSwitch().open(new TV());
        new SuperSwitch().open(new TV());
    }

}


/**
 * 开关
 */
interface Switch {

    void open(Electrice electrice);

}

/**
 * 电器
 */
interface Electrice {

    public void start();

}

/**
 * 普通开关
 */
class GeneralSwitch implements Switch {

    public void open(Electrice electrice) {
        System.out.println("普通开关");
        electrice.start();
    }

}

/**
 * 超级开关
 */
class SuperSwitch implements Switch {

    public void open(Electrice electrice) {
        System.out.println("超极开关");
        electrice.start();
    }
}


class TV implements  Electrice {
    public void start() {
        System.out.println("开启了电视");
    }
}

